package com.example.administrator.yunniuusedcar.holder;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.administrator.common.ui.BaseAdapterRV;
import com.example.administrator.common.ui.BaseHolderRV;
import com.example.administrator.yunniuusedcar.R;
import com.example.administrator.yunniuusedcar.model.mode_benn.MainInfoHeadBeen;
import com.example.administrator.yunniuusedcar.model.mode_benn.WZ_ArticleInfoBean;
import com.squareup.picasso.Picasso;

/**  活动资讯
 * Created by USER2015 on 2017/12/17.
 */

public class MainActionHolder extends BaseHolderRV<WZ_ArticleInfoBean.Data> {
    private RelativeLayout LLActivityInformage;
    private ImageView ivInfomationPage;
    private View viewColor;
    private TextView tvInfomationTitle;
    private TextView tvInfomationTime;
    private TextView tvInfomationSoure;
    private TextView tvInfomationFrom;
    private MainInfoHeadBeen maininfoB;

    /**
     * 构造方法
     *
     * @param context     上下文对象
     * @param parent      指RecyclerView控件
     * @param adapter     适配器
     *1 @param layoutResId RecyclerView的一个item布局文件
     */
    public MainActionHolder(Context context, ViewGroup parent,
                            BaseAdapterRV<WZ_ArticleInfoBean.Data> adapter) {
        super(context, parent, adapter, R.layout.fragment_choosecar02_information);
    }

    @Override
    public void onFindViews(View itemView) {
         initFindBid();
    }

    @Override
    protected void onRefreshView(WZ_ArticleInfoBean.Data bean, int position) {
        Picasso.with(context).load(bean.logo).into(ivInfomationPage);
        tvInfomationTitle.setText(bean.title);
        tvInfomationTime.setText(bean.add_time);    // 时间

        tvInfomationSoure.setText("来源：" + bean.source);
        tvInfomationFrom.setText(bean.content);

    }


    private void initFindBid() {
        LLActivityInformage = (RelativeLayout) itemView.findViewById(R.id.LL_activityInformage);
        ivInfomationPage =  itemView.findViewById(R.id.iv_infomationPage);  //图片
        viewColor = (View) itemView.findViewById(R.id.view_color);      //边界颜色条 view
        tvInfomationTitle = (TextView) itemView.findViewById(R.id.tv_infomationTitle);  //标题
        tvInfomationTime = (TextView) itemView.findViewById(R.id.tv_infomationTime);
        tvInfomationSoure = (TextView) itemView.findViewById(R.id.tv_infomationSoure);
//        tvInfomationFrom = (TextView) itemView.findViewById(R.id.tv_infomationFrom);

        LLActivityInformage.setOnClickListener(new View.OnClickListener() {   // 点击图片后 条到 资讯详情
            @Override
            public void onClick(View view) {
                /////

            }
        });
    }
}
